<?php
declare (strict_types=1);

namespace app\api\controller;

use app\api\model\Travel;

class Tangseng extends Api
{
    /**
     * {@inheritdoc}
     * rules:
     * actions 控制器列表: * 全部控制器
     * roles 允许访问角色:
     * all 全部;
     * no_all 不允许任何人进;
     * login 登录(默认);
     * allow 验证规则:
     * no_checkTime 不验证时间戳;
     * no_checkSign  不验证签名;
     */
    protected $auth = [
        [
            'actions' => [],
            'roles' => 'all',
            'allow' => [],
        ]
    ];
    protected $model;
    protected $redis;

    public function initialize()
    {
        parent::initialize();
        $this->model = new Travel();
    }

    //马匹配置
    public function getHorsesConfig()
    {
        $res = $this->model->getHorsesConfig();
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //获取我的马匹配置
    public function getHorsesData()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->getHorsesData($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //购买马匹
    public function buyHorses()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->buyHorses($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //今日收益
    public function getTodayEarnings()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->getTodayEarnings($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //获取游戏配置
    public function getGameConfig()
    {
        $res = $this->model->getGameConfig();
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //铸造金箍棒
    public function castJGB()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->castJGB($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //铸造金箍棒记录
    public function getCastJGBRecords()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->getCastJGBRecords($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //维修金箍棒
    public function maintainJGB()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->maintainJGB($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //维修金箍棒记录
    public function getRepairJGBRecords()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->getRepairJGBRecords($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //大反击游戏信息
    public function getGameInfo()
    {
        $res = $this->model->getGameInfo($this->userId);
        $this->result($res['msg'], $res['data'], $res['code']);
    }


    //用户投注大反击
    public function userDfjBetOn()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->userDfjBetOn($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //获取本周和上周大反击记录
    public function getWeekDFJRank()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->getWeekDFJRank($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //大反击记录
    public function getDFJRecords()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->getDFJRecords($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }


    //大反击收益统计
    public function getCensusInfo()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->getCensusInfo($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }

    //大反击收益统计
    public function queryEarnings()
    {
        $params = request()->param();
        $params['user_id'] = $this->userId;
        $res = $this->model->queryEarnings($params);
        $this->result($res['msg'], $res['data'], $res['code']);
    }


}
